home *** CD-ROM | disk | FTP | other *** search
- Path: sundog.tiac.net!tiac
- From: mathman@tiac.net
- Newsgroups: comp.lang.c
- Subject: Output problem for c student---Help needed
- Date: Sat, 17 Feb 1996 03:31:59 GMT
- Organization: The Internet Access Company
- Message-ID: <4g3j4a$6tc@sundog.tiac.net>
- Reply-To: mathman@tiac.net
- NNTP-Posting-Host: mathman.tiac.net
-
- I have almost finished my first assignment. I am using BC++ Ver. 4.52.
- on Win95. The program is a simple load data calculate and print.
- The data is hours worked, clock number and wage. What the problem is:
- I can compile my program using makefile and it says success. Then a dos
- window comes up with my first question. The program completes its
- appointed loops fine. When I check the output file there is nothing
- there. It looks like this.
- #include<stdio.h>
- main()
- {
- int stuff;
- float morestuff;
- FILE *file_ptr;
- file_ptr = fopen("out.txt","w");
-
- printf(first question);
- scanf(stuff);
- while(condition);
- {
- Enter the data in this section.
- Then I have some
- fprintf(file_ptr,\n"--------------");
- fprintf(file_ptr, "col. names");
- fprintf(file_ptr,"-----------------");
-
- fprintf(file_ptr,"\n%6.0f",clock_number);
- fprintf(file_ptr,"%12.2f",wage);
- fprintf(file_ptr,"%16.1f",hours);
-
- pay = wage*hours;
- fprinf(file_ptr,"%12.2f",pay);
- }
- return 0;
- }
- There are obvious details that I have left out such as the col heading
- and the stuff, I do not think that they are that important to the
- problem. What I cannot get is by coing into Explorer a print out of the
- dat in the file out.txt.
- I check it before I print and it does not even change. Can anyone see
- what is missing. This program is complete as I have compiled it.
- Thanks for any help.
- BTW, this compiler is new for me as is the language. I have no idea were
- to look for usable examples to this problem in the Borland manuals.
-